
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="shortcut icon" href="../ico/logo.ico" type="image/x-icon" />
    <title>协同办公</title>
    <link rel="stylesheet" href="../../static/css/bootstrap.css">
    <link rel="stylesheet" href="../../static/js/layui/css/layui.css">
    <link rel="stylesheet" href="../../static/css/font.css">
    <style>
}
        #boxes>div{
            margin-left: 5%;
        }
        #left>a{
            margin-top:30px;
            margin-left: 20px;
            cursor: pointer;
        }
        #logo{
            margin-top: 20px;
            margin-left: 6%;
            height: 80px;
            display: flex;
            flex-direction: row;
        }
        #tiao{
            width: 100%;
            height: 50px;
            background-image: url("../../static/imaegs/breadbg.gif");
            display: flex;
            flex-direction: row;
        }
        #right{
            margin-top: 10px;
            margin-left: 20%;

        }
        #from_block{
            width: 80%;
            margin-left: 10%;

        }
        #left{
            margin-left: 10%;
            margin-top: 10px;
        }
        #user{
            background-color: transparent;
            border: hidden;
            width:150px;

        }
        #logo-img{
            width:150px;
            height: 93px;
        }
        #logo-img>img{
            width: 90%;
        }
        #logo-right{
            width: 300px;
            height: 50px;
            margin-left:50%;
        }
        #head-img{
            width: 70px;
            height: 70px;
            border: 1px blue solid;
        }
        label{
            margin-left: 5px;
            font-size: 9px;

        }

        #time{
            float: right;
            margin-right: 50px;
            font-size: 9px;
        }
        #overTime{
            color: crimson;
            font-size: 9px;
            float: right;
            margin-right: 5px;
        }
        #file{
            margin-right: 10px;
            margin-top: 8px;
            float: right;
        }
        #accept{
            float: right;
            margin-right: 10px;
            margin-top: 8px;
        }
    </style>
</head>
<body>
<div id="logo"><div id="logo-img"><img src="../../static/imaegs/logo/logo2.png"></div>

</div>
<div id="tiao">
    <div id="left"><a href="index.php"><i class="layui-icon" style="font-size: 20px; color: #1E9FFF;">&#xe68e;</i>&nbsp;首页</a>
        <a href="task_list.php" style="border-bottom: 2px blue solid"> <i class="layui-icon" style="font-size: 20px; color: #1E9FFF;">&#xe6b2;</i>&nbsp;我的任务</a>
        <a href="file.php"><i class="layui-icon" style="font-size: 20px; color: #1E9FFF;">&#xe621;</i>&nbsp;我的文件</a>
        <a href="user_list.php"><i class="layui-icon" style="font-size: 20px; color: #1E9FFF;">&#xe613;</i>&nbsp;成员信息</a></div>
    <div id="right"><a style="color:grey">您好！&nbsp;</a><i class="layui-icon" style="font-size: 20px; color: #1E9FFF;">&#xe66f;</i><a href="">个人中心</a>&nbsp;&nbsp;<a href="../loginU.html">退出</a></div>
</div>

<div id="from_block">

    <hr class="layui-bg-blue">
    <div class="layui-row layui-col-space15" >
        <div class="layui-col-md12" id="uul">

        </div>
    </div>

</div>
<script src="../../static/js/jquery.min.js"></script>
<script src="../../static/js/layui/layui.all.js"></script>
<script>
    var url = location.search;
    var id = url.split("=")[1];
    $.ajax({
        type: 'post',
        cache: false,
        url: '../../php/user/self_task.php?id='+id,
        data: {

        },
        dataType: 'json',
        success: function (data) {
            $coun = data.count;
            $dat = data.data;

            for ($i = 0; $i < $coun; $i++) {
                $id = $dat[$i].id;
                $user = $dat[$i].user;
                $title=$dat[$i].title;
                $time=$dat[$i].over_time;
                $remark=$dat[$i].bei;
                $content=$dat[$i].content;
                $addtime=$dat[$i].create_time;
                $url=$dat[$i].url;
                var li_id = $id;
                $li = $("<div id="+$id+" class=\"layui-card\" id=\"card\">\n" +"<hr class=\"layui-bg-red\">"+
                    "<div class=\"layui-card-header\">"+"任务详情："+"<button style=\"float: right;margin-top: 3px\" class=\"layui-btn layui-btn-primary layui-btn-sm\" onclick='del("+$id+")'><i class=\"layui-icon\"></i></button>"+"<button id='file' class=\"layui-btn layui-btn-xs\" >"+"<a href='"+$url+"' download='file'>"+"附件下载"+"</a>"+"</button>"+"<a id='overTime'>"+"任务截至时间："+$time+"</a>"+"<a>"+"</a>"+"</div>" +
                    "                    <div class=\"layui-card-body\">\n" +$content+"<br>" +
                    "<hr>"+"<div class=\"layui-card-header\">"+"备注："+"</div>"+
                    $remark+"<br>"+
                    "                       <span id=\"time\">"+ "发布时间："+$addtime+"&nbsp;|&nbsp;"+"发布人："+$user+"</span>" +
                    "                          <br>\n" +
                    "                    </div>\n" +
                    "                </div>");
                $("#uul").append($li);

            }
        },
        error: function (data) {
            layer.msg("获取数据异常");
        }
    });
    function del(id) {
        layer.confirm('您确定要删除该任务吗？', function(index) {
            $.ajax({
                type: 'post',
                cache: false,
                url: '../../php/user/del_task.php',
                data: {
                    "id":id,
                },
                dataType: 'json',
                success: function (data) {
                    layer.msg(data.message);
                    var li=document.getElementById($id);
                    li.remove();
                },
                error: function (data) {
                    layer.msg("删除失败");
                }
            });


        });


    }
</script>

</body>
</html>